using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class logged_Default : System.Web.UI.Page
{
    private ActivUFRJ.Classes.Usuario.Usuario usuario = ActivUFRJ.Utilitarios.Usuario.GetSessao();

    protected void Page_Load(object sender, EventArgs e)
    {

        // valida a sessao do usuario
        ActivUFRJ.Utilitarios.Usuario.ValidarSessao(usuario);

        CarregarCaixaEntrada();
        CarregarCaixaSaida();
    }

    private void CarregarCaixaEntrada()
    {
        gridViewCaixaEntrada.DataSource = ActivUFRJ.Classes.Geral.MgrMensagem.GetListaMensagensCaixaEntrada(usuario);
        gridViewCaixaEntrada.EnableSortingAndPagingCallbacks = false;
        gridViewCaixaEntrada.DataBind();
    }

    private void CarregarCaixaSaida()
    {
        gridViewCaixaSaida.DataSource = ActivUFRJ.Classes.Geral.MgrMensagem.GetListaMensagensCaixaSaida(usuario);
        gridViewCaixaSaida.EnableSortingAndPagingCallbacks = false;
        gridViewCaixaSaida.DataBind();
    }
    protected void lbEstatisticas01_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 1;
    }
    protected void lbVersoes01_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 2;
    }
    protected void lbUltimasNoticias02_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 0;
    }
    protected void lbEstatisticas02_Click(object sender, EventArgs e)
    {

    }
    protected void lbVersoes02_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 2;
    }
    protected void lbUltimasNoticias03_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 0;
    }
    protected void lbEstatisticas03_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 1;
    }
    protected void lbRecomendacoes01_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 3;
    }
    protected void lbRecomendacoes02_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 3;
    }
    protected void lbRecomendacoes03_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 3;
    }

    protected void btnExcluirMensagens_Click(object sender, EventArgs e)
    {
        System.Collections.ArrayList alMensagensSelecionadas = new ArrayList();
        for (int i = 0; i < gridViewCaixaEntrada.Rows.Count; i++)
        {
            GridViewRow row = gridViewCaixaEntrada.Rows[i];
            bool isChecked = ((CheckBox)row.FindControl("chkSelect")).Checked;

            if (isChecked)
            {
                DataKey key = gridViewCaixaEntrada.DataKeys[row.RowIndex];
                alMensagensSelecionadas.Add((int)key.Value);
            }
        }
        int j = 11;
    }
}
